﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using DataFileApplication_WPF.Extensions;
using System.Windows.Controls;
using System.Windows;

namespace DataFileApplication_WPF.Common
{
    public class DataGridValueTemplateSelector : DataTemplateSelector
    {
        public DataTemplate DataGridIntTemplate { get; set; }
        public DataTemplate DataGridFloatTemplate { get; set; }
        public DataTemplate DataGridDoubleTemplate { get; set; }
        public DataTemplate DataGridBoolTemplate { get; set; }
        public DataTemplate DataGridTextTemplate { get; set; }

        public override DataTemplate SelectTemplate(object item, DependencyObject container)
        {
            if (item is EnumDataType enumType)
            {
                switch (item)
                {
                    case EnumDataType.Integer:
                        return DataGridIntTemplate;
                   // case EnumDataType.Float:
                       // return DataGridFloatTemplate;
                    case EnumDataType.Double:
                        return DataGridDoubleTemplate;
                    case EnumDataType.String:
                        return DataGridTextTemplate;
                    case EnumDataType.Boolean:
                        return DataGridBoolTemplate;
                }
            }
            return base.SelectTemplate(item, container);
        }
    }
}
